---
title: "Sequin CLI"
sidebarTitle: "Sequin CLI"
description: "Reference for the Sequin CLI. Learn about installation options, context management, configuration commands, and local development tunnels."
---

With the Sequin CLI, you can easily manage resources and build and test features locally.

## Installation

### Install with Homebrew

```bash
brew install sequinstream/sequin/sequin
```

### Install with shell

```bash
curl -sf https://raw.githubusercontent.com/sequinstream/sequin/main/cli/installer.sh | sh
```

### Build from source

```bash
git clone git@github.com:sequinstream/sequin.git
cd cli && make build
```

Reload your console and test that it's installed:

```bash
sequin --help
```

## Contexts

The Sequin CLI uses **contexts** to manage different configurations and environments. Each context stores:
- API token for authentication
- Hostname configuration (for self-hosted Sequin instances)
- TLS settings (for self-hosted Sequin instances)


### `sequin context`

Display available context commands:

```bash
sequin context --help
```

### `sequin context add`

Create a new context:

```bash
sequin context add default --api-token={{my-token}} --set-default
```

#### Flags

- `--api-token`: Your authentication token
- `--set-default`: Set as the default context

**Self-hosted flags:**

For self-hosted Sequin instances, you'll specify:

- `--hostname`: API hostname of your Sequin instance (defaults to api.sequinstream.com)
- `--tls`: Enable/disable TLS (enabled by default)

**Cloud flags:**
- `--tunnel-ports`: Configure default tunnel ports

### `sequin context ls`

List all contexts:

```bash
sequin context ls
```

### `sequin context select`

Switch between contexts:

```bash
sequin context select <context-name>
```

### Using contexts with commands

Use a specific context for any command with the `--context` flag:

```bash
sequin tunnel --ports=5432:my-pg-db --context=staging
```

## Config

The `config` command group allows you to manage Sequin resources using YAML configuration files. This provides a declarative way to create and manage databases, sinks, HTTP endpoints, and other resources.

### `sequin config`

See the [sequin.yaml reference](/reference/sequin-yaml) for detailed configuration options and examples.

#### Commands

- `sequin config export` - Export current configuration as YAML
- `sequin config plan [file]` - Preview changes from a YAML file
- `sequin config apply [file]` - Apply changes from a YAML file
- `sequin config interpolate` - Interpolate environment variables in a YAML file

The `file` argument defaults to `sequin.yaml` if not specified.

#### Flags

- `--auto-approve` - Skip interactive approval for the `apply` command (useful for CI/CD)

#### Example Workflow

```bash
# Export current config
sequin config export > sequin.yaml

# Edit the configuration
vim sequin.yaml

# Preview changes
sequin config plan

# Apply changes if they look correct
sequin config apply

# Apply changes non-interactively (for CI/CD)
# Not recommended for production environments
sequin config apply --auto-approve
```

#### Using with Contexts

All config commands respect the current context and can be used with the `--context` flag:

```bash
sequin --context=prod config plan
sequin --context=staging config apply
```

<Info>
The `export` command is experimental. Exported configurations may need manual adjustments before use:

- `account` and `user` sections are not exported
- Encrypted fields like passwords need to be manually specified
</Info>




